﻿@{
    Layout = null;
}
@model System.Collections.IEnumerable
<!DOCTYPE html>
<html>
@Html.Partial("LoadPanelPartial")
<head>
<title></title>
    @if (false)
    {
        <script src="../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

      <link href="@Url.Content("~/Content/jquery-ui.css", true)" rel="stylesheet" type="text/css" />
      
    <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/jquery-ui.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/regex.js", true)" type="text/javascript"></script>
     <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    @Html.DevExpress().GetStyleSheets(
                new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme }

)
    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)

    <script type="text/javascript">
        function OnBeginCallback(s, e) {
            e.customArgs["command"] = e.command;
            e.customArgs["pageIndex"] = s.pageIndex;
            e.customArgs["pageCount"] = s.pageCount;
            e.customArgs["pageRowSize"] = s.pageRowSize;
            e.customArgs["pageRowCount"] = s.pageRowCount;
            e.customArgs["FAllowanceClassNo"] = $("#hidFAllowanceClassNo").val();
            e.customArgs["NSRMC"] = $("#hidNSRMC").val();
            e.customArgs["NSRBM"] = $("#hidNSRBM").val();
            e.customArgs["FFinancePropNo"] = $("#hidFFinancePropNo").val();
            e.customArgs["FEnterprisePropNo"] = $("#hidFEnterprisePropNo").val();
        }
        
        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnAdd":
                    {
                        Add();
                        
                        break;
                    }
                case "btnClose":
                    {
                        window.close();
                        break;
                    }
            }
        }


        function Changed() {
            $.ajax({
                type: 'POST',
                url: rootPath + '/TaxPayerManager/GetList',
                data: { fEnterprisePropNo: ASPxClientComboBox.Cast("FEnterprisePropNo").GetValue() },
                success: function (result) {
                    ASPxClientComboBox.Cast("FFinancePropNo").ClearItems()
                    var List = JSON.parse(result);
                    for (var i = 0; i < List.length; i++) {
                        ASPxClientComboBox.Cast("FFinancePropNo").AddItem(List[i].FFinancePropShortName, List[i].FFinancePropNo, "");
                    }
                }
            });
        }

        function Add() {
            var checkNo = "";
            var checkNoList = ASPxClientGridView.Cast("gvEditing").GetSelectedKeysOnPage();
            for (var i = 0; i < checkNoList.length; i++) {
                checkNo += ""+checkNoList[i] + ",";
            }
            
            $.ajax({
                type: 'POST',
                url: rootPath + '/AllowanceCalcManage/AddToIssue',
                data: { policyIDList: checkNo, issueID: $("#hidissueID").val() },
                success: function (result) {
                    if (result == "ok") {
                        gvEditing.Refresh();
                    }
                    else {
                        alert("系统异常");
                    }
                }
            });

        }

        //查询
        function search() {
            $("#hidNSRMC").val(ASPxClientTextBox.Cast("NSRMC").GetText());
            $("#hidNSRBM").val(ASPxClientTextBox.Cast("NSRBM").GetText());
            $("#hidFFinancePropNo").val(ASPxClientTextBox.Cast("FFinancePropNo").GetValue());
            $("#hidFEnterprisePropNo").val(ASPxClientTextBox.Cast("FEnterprisePropNo").GetValue());
            gvEditing.Refresh();
        }

        function undo() {
            ASPxClientTextBox.Cast("NSRMC").SetText("");
            ASPxClientTextBox.Cast("NSRBM").SetText("");
            ASPxClientTextBox.Cast("FFinancePropNo").SetValue("");
            ASPxClientTextBox.Cast("FEnterprisePropNo").SetValue("");

        }
    </script>
</head>
<body>
        @Html.DevExpress().Menu(settings => 
        {
            settings.Name = "toolBarMenu";
            settings.ItemAutoWidth = false;
            settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
            settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
            settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);

            settings.Items.Add(item =>
            {
                item.Name = "btnAdd";
                item.Text = "加入";
                item.ClientEnabled = true;
                item.Image.Url = Url.Content("~/Content/ControlImages/edit_add.png");

            });
            settings.Items.Add(item =>
            {
                item.Name = "btnClose";
                item.Text = "关闭";
                item.ClientEnabled = true;
                item.Image.Url = Url.Content("~/Content/ControlImages/button_cancel.png");

            });
            
            settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
            settings.ItemLinkMode = ItemLinkMode.ContentBounds;
        }).GetHtml()

<table width="100%" class="tableForm">
        <tr>
           <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "纳税编码:"; }).GetHtml()</td>
           <td class="tdClass">
                 @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "NSRBM";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(150);
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
              
           </td>
           <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "纳税人名称:"; }).GetHtml()</td>
           <td class="tdClass">
                     @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "NSRMC";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(150);
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
              
           </td>
           <td class="tdClass">
           @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnSearch";
                settings.Text = "查询";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/search.png");
                settings.ClientSideEvents.Click = "search";
            }).GetHtml()

             @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnUndo";
                settings.Text = "重置";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/undo_blue.png");
                settings.ClientSideEvents.Click = "undo";
            }).GetHtml()

           </td>         
        </tr>
        <tr>
            <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "企业性质:"; }).GetHtml()</td>
           <td class="tdClass">
           @Html.DevExpress().ComboBox(settings =>
               {
                   settings.Name = "FEnterprisePropNo";
                   settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(150);
                   settings.Properties.TextField = "FEnterprisePropName";
                   settings.Properties.ValueField = "FEnterprisePropNo";
                   settings.Properties.ClientSideEvents.SelectedIndexChanged = "Changed";
               }).BindList(ViewData["EnterprisePropList"]).Bind(ViewData["FEnterprisePropNo"]).GetHtml()
           </td>    
            <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "资金性质:"; }).GetHtml()</td>
           <td class="tdClass">
           @Html.DevExpress().ComboBox(settings =>
               {
                   settings.Name = "FFinancePropNo";
                   settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(150);
                   settings.Properties.TextField = "FFinancePropShortName";
                   settings.Properties.ValueField = "FFinancePropNo";
                   settings.Properties.EnableClientSideAPI = true;
               }).BindList(ViewData["FinancePropList"]).Bind(ViewData["FFinancePropNo"]).GetHtml()
              
           </td>            
           <td class="tdClass">

           </td> 
                
        </tr>
    </table>
        @Html.Partial("SelectCompanyListPartial", Model)

            @Html.Hidden("hidFAllowanceClassNo", ViewData["FAllowanceClassNo"])
                @Html.Hidden("hidissueID", ViewData["issueID"])

            @Html.Hidden("hidNSRMC","")
            @Html.Hidden("hidNSRBM", "")
            @Html.Hidden("hidFFinancePropNo", "")
            @Html.Hidden("hidFEnterprisePropNo", "")
   
         
    <script>
        lp.Hide();
    </script>
</body>
</html>
